//
//  main.c
//  C_3 创建小工具
//
//  Created by Robin on 16/3/16.
//  Copyright © 2016年 cnbm. All rights reserved.
//

#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <unistd.h>

int main(int argc, char * argv[]) {
    
    char *delivery = "";
    int count = 0;
    int thick = 0;
    char ch;
    
    while ((ch = getopt(argc, argv, "d:t")) != EOF)
     
        switch (ch) {
            case 'd':
                delivery = optarg;
                break;
                
            case 't':
                thick = 1;
                break;
                
            default:
                printf(" ch == %c \n",ch);
                
                fprintf(stderr, "Unknown Option: '%s'\n",optarg);
                break;
                
            return 1;
        }
        
    
    argc -= optind;
    argv += optind;
    
    if (thick) {
        puts("thick crust\n");
    }
    
    if (delivery[0]) {
        printf("To be deliveried : %s. \n",delivery);
    }
    
    puts("Ingredients:");
    
    for (count =0; count<argc; count++) {
        puts(argv[count]);
    }
    
    return 0;
}
